<template>
  <div>
    <page-list :x-uri="uri" :x-tabs="tabs" :checkbox-item="false">
      <!-- 页面操作按钮 -->
      <template v-slot:page-button>
        <el-button v-auth="'market.coupon.couponcard.grant'" size="mini" type="primary" @click="visible = true">发放优惠券</el-button>
      </template>
    </page-list>
    <grant :visible.sync="visible" :coupon-id="$route.params.id" />
  </div>
</template>

<script>
import PageList from '@public/template/page_list.vue';
import Grant from '../../grant.vue';
export default {
  components: {
    PageList,
    Grant
  },
  data() {
    return {
      visible: false,
      uri: '/course/admin/coupon/couponCard/' + this.$route.params.id + '/details',
      tabs: [
        {
          title: '优惠券',
          uri: '/market/coupon/couponCard/index',
          meta: {
            permission: 'market.coupon.couponcard.list'
          }
        },
        {
          title: '领取及使用详情',
          uri: '/market/coupon/couponCard/' + this.$route.params.id + '/details',
          meta: {
            permission: 'market.coupon.couponcard.details'
          }
        }
      ]
    };
  }
};
</script>
